package ink.metoo.auto.fishpi.chatroom

class RedPacket {

    var msg: String? = null
    var recivers: String = ""
    var msgType: String = ""
    var count: Int = 0
    var money: Int = 0
    var type: String? = null
    var got: Int = 0
    var who: List<ReceivedInfo> = emptyList()

    class ReceivedInfo {

        var userId: String? = null
        var userName: String? = null
        var avatar: String? = null
        var userMoney: Int? = null
        var time: String? = null

    }

    val typeEnum: Type
        get() = Type.entries.find { it.value == type } ?: Type.RANDOM

    enum class Type(val value: String, val description: String, val minCount: Int) {

        HEARTBEAT("heartbeat", "心跳红包", 5),
        RANDOM("random", "拼手气红包", 2),
        AVERAGE("average", "平分红包", 2),
        SPECIFY("specify", "专属红包", 1),
        ROCK_PAPER_SCISSORS("rockPaperScissors", "猜拳红包", 1)

    }

}